<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@page import="org.apache.commons.lang.StringUtils"%><%@page import="com.pignest.hotel.service.CardService"%>
<%@page import="com.pignest.hotel.beans.Member"%><%@page import="com.pignest.framework.util.Utils"%>
<%@page import="java.util.List"%><%@page import="com.pignest.hotel.service.ReceptionService"%>
<%@page import="com.pignest.hotel.util.DateUtil"%><%@page import="com.pignest.hotel.beans.TbAccounts"%>
<%
String card = request.getParameter("card");
if (StringUtils.isEmpty(card)) {	// || card not exists
%>
<jsp:forward page="index.jsp"></jsp:forward>
<%
	return;
} else {
	CardService service = com.pignest.hotel.spring.Services.getCardService();
	Member m = service.getMemberByCard(card);
	if (m == null) {
		%>
		<jsp:forward page="index.jsp"></jsp:forward>
		<%
		return;
	}
	request.setAttribute("m", m);
	request.setAttribute("index", 2);
%>
<jsp:include page="frame.jsp" ></jsp:include>
<div id="selfhelpContent" style="padding:0.5em 3em;">
<table cellspacing="0" cellpadding="0" style="width:100%">
	<tbody>
		<tr>
			<td width="50%" valign="top">
<table cellspacing="0" cellpadding="0" class="formtable">
	<caption>
	<h2>个人资料</h2>
	<p>如果你的个人资料有误或者更换了联系方式，请到总服务台更改。</p>
	</caption>
	<tbody>
		<tr>
			<th style="width: 10em;">姓名</th>
			<td><%=m.getName() %></td>
		</tr>
		<tr>
			<th style="width: 10em;">级别</th>
			<td><%=m.getMemberLevel().getMemberlevel()%></td>
		</tr>
		<tr>
			<th style="width: 10em;">状态</th>
			<td>${m.state2}</td>
		</tr>
		<tr>
			<th style="width: 10em;">余额</th>
			<td><%=Utils.toPrice(m.getBalance()) %></td>
		</tr>
		<tr>
			<th style="width: 10em;">积分</th>
			<td>${m.integral}</td>
		</tr>
		<tr>
			<th>手机号码</th>
			<td>${m.mobile }</td>
		</tr>
		<tr>
			<th style="width: 10em;">性别</th>
			<td><%=m.getSex()%></td>
		</tr>
		<tr>
			<th style="width: 10em;">证件</th>
			<td><%=m.getCertificatType() %></td>
		</tr>
		<tr>
			<th style="width: 10em;">证件号码</th>
			<td><%=m.getCertificateNo() %></td>
		</tr>

		<tr>
			<th>生日</th>
			<td><%=m.getBirthday2() %></td>
		</tr>
		<tr>
			<th>地址</th>
			<td><%=m.getAddress() %></td>
		</tr>
		<tr>
			<th>办理时间</th>
			<td>${m.dealTime2}</td>
		</tr>
	</tbody>
</table>
			</td>
			<td width="50%" valign="top">
<table cellspacing="0" cellpadding="0" class="formtable">
	<caption>
	<h2>最近财务记录</h2>
	<p>如果你的个人资料有误或者更换了联系方式，请到总服务台更改。</p>
	</caption>
	<tbody>
<%
List<TbAccounts> as = com.pignest.hotel.spring.Services.getReceptionService().listRecentAccounts(m);
if (as == null || as.isEmpty()){
%>
	<tr><td>暂无记录</td></tr>
<%	
}else{
	for (TbAccounts a:as) {
%>
		<tr>
			<th style="width: 10em;"><%=DateUtil.toStringHotel(a.getOptime())%></th>
			<td><%=a.getLiving().getRoom().getName()%></td>
			<td><%=a.getName()%></td>
			<td><%=Utils.toPrice(a.getPrice())%></td>
		</tr>
<%
	}
}
%>
	</tbody>
</table>
			</td>
		</tr>
	</tbody>
</table>
</div>
<%
}
%>
